unit storehouseselect;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, DbCtrls,
  DBGrids, Buttons;

type

  { TfrmStoreHouseSelect }

  TfrmStoreHouseSelect = class(TForm)
    btnSelect: TBitBtn;
    btnClose: TBitBtn;
    DBGStoreHouses: TDBGrid;
    DBNavigator: TDBNavigator;
    procedure btnSelectClick(Sender: TObject);
    procedure DBGStoreHousesDblClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  frmStoreHouseSelect: TfrmStoreHouseSelect;

implementation

{$R *.lfm}
uses main;

{ TfrmStoreHouseSelect }

procedure TfrmStoreHouseSelect.btnSelectClick(Sender: TObject);
begin
  FrmMain.storeHouseSelectedId:=DBGStoreHouses.DataSource.DataSet.FieldByName('id').AsInteger;
  FrmMain.storeHouseSelectedTitle:=DBGStoreHouses.DataSource.DataSet.FieldByName('title').AsString;
  Close;
end;

procedure TfrmStoreHouseSelect.DBGStoreHousesDblClick(Sender: TObject);
begin
  btnSelect.Click;
end;

procedure TfrmStoreHouseSelect.FormShow(Sender: TObject);
begin
  FrmMain.storeHouseSelectedId:=0;
  FrmMain.storeHouseSelectedTitle:=EmptyStr;
end;

end.

